package controllers;

import models.*;
import models.Object;
import play.mvc.*;

import java.util.*;

public class Application extends Controller {

    public static void index() {
        List<Object> objects = Object.all().fetch();
        render(objects);
    }
    
    public static void showObject(Long id) {
        Object object = Object.findById(id);
        render(object);
    }

    public static void showObjectLevel(Long id) {
        ObjectLevel objectLevel = ObjectLevel.findById(id);
        render(objectLevel);
    }
    
    public static void createObject(String name) {
        Object object = new Object(name,"description");
        object.save();
    }

    public static void showReservationForm(Long id) {
        ObjectLevelItem objectLevelItem = ObjectLevelItem.findById(id);
        List<Event> events = Event.all().fetch();
        List<User> users = User.all().fetch();
        render(objectLevelItem,events,users);
    }

}